const axios = require('axios')
const FormData = require('form-data')
const fs = require('fs')
let form = new FormData()

form.append("key", "ffff")
form.append("token", "XXXXX")
form.append('file', fs.createReadStream(__dirname + '/logo.jpg'), {
    filename: 'logo.jpg'
})

axios.create({
    headers: form.getHeaders()
}).post('http://upload-z2.qiniup.com', form).then(response => {
    console.log(response.data);
}).catch(error => {
    if (error.response) {
        console.log(error.response);
    }
    console.log(error.message);
});